package operation;

import book.Book;
import book.BookList;

public class ReturnOperation implements IOperation{
    public void work(BookList bookList){
//        System.out.println("归还图书");
        System.out.println("请输入归还图书的名字:");
        String name = scanner.nextLine();
        int count = bookList.getCount();
        for (int i = 0; i < count; i++) {
            Book book = bookList.getBook(i);
            if (name.equals(book.getName())){
                book.setBorrowed(false);
                System.out.println("归还成功");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有你要归还的这本书");
    }
}
